package com.xhs.service.impl;

import lombok.extern.slf4j.Slf4j;

/**
 * @desc: 使用lambda表达式创建线程
 * @projectName: tools-parent
 * @author: xhs
 * @date: 2022/12/5 21:30
 * @version: JDK 1.8
 */
@Slf4j
public class Thread4ServiceImpl {

    public static void main(String[] args) {
        log.info(">>>>>>>>>>>>>>使用lambda表达式创建线程:{},我是主线程<<<<<<<<<<<<<<<<<<<<", Thread.currentThread().getName());
        new Thread(() -> {
            log.info(">>>>>>>>>>>>>>使用lambda表达式创建线程:{},我是子线程<<<<<<<<<<<<<<<<<<<<", Thread.currentThread().getName());
        }).start();
        log.info(">>>>>>>>>>>>>>使用lambda表达式创建线程:{},我是主线程<<<<<<<<<<<<<<<<<<<<", Thread.currentThread().getName());
    }
}
